/*******************************************************************************
* Project: QSAR(Cute Software Architecture)
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: ComMType.h
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: ComM
*
*******************************************************************************/

#ifndef COMMTYPE_H
#define COMMTYPE_H

/** HEADER FILES **/
#include "PlatformCfg.h" 


/** MACRO DEFINITION **/


/** TYPEDEF DEFINITION **/
typedef uint8 ComM_ModeType;
#define COMM_NO_COMMUNICATION ((ComM_ModeType)0x00)
#define COMM_SILENT_COMMUNICATION ((ComM_ModeType)0x01)
#define COMM_FULL_COMMUNICATION ((ComM_ModeType)0x02)
#define COMM_FULL_COMMUNICATION_WITH_WAKEUP_REQUEST ((ComM_ModeType)0x03)

typedef uint8 ComM_InitStatusType;
/* The COM Manager is not initialized or not usable. This shall be the default value after reset. This status shall have the value 0. */
#define COMM_UNINIT ((ComM_InitStatusType)0x00)
/* The COM Manager is initialized and usable */
#define COMM_INIT ((ComM_InitStatusType)0x01) 

typedef uint8 ComM_PncModeType;
/* PNC is requested by a local ComM user */
#define COMM_PNC_REQUESTED ((ComM_PncModeType)0x00)
/* PNC is requested by a remote ComM user */
#define COMM_PNC_READY_SLEEP ((ComM_PncModeType)0x01)
/* PNC is active with no deadline monitoring */
#define COMM_PNC_PREPARE_SLEEP ((ComM_PncModeType)0x02)
/* PNC does not communicate */
#define COMM_PNC_NO_COMMUNICATION ((ComM_PncModeType)0x03)
/* PNC is requested by a local ComM user. The mode is used to indicate the BswM, that an active PNC request should trigger also 
a wake-up of the used communication hardware, if this is supported and configured (e.g. used for Ethernet switch port switching 
in combination with OA TC10 compliant Ethernet hardware). */
#define COMM_PNC_REQUESTED_WITH_WAKEUP_REQUEST ((ComM_PncModeType)0x04)


/* State and sub-state of ComM state machine
ComM states vs. Communication Modes: 
COMM_NO_COM* : Communication Mode='No Communication' 
COMM_FULL_COM*: Communication Mode='Full Communication'
COMM_SILENT_COM: Communicatio Mode='Silent Communication' */
typedef uint8 ComM_StateType;
#define COMM_NO_COM_NO_PENDING_REQUEST ((ComM_StateType)0x00)
#define COMM_NO_COM_REQUEST_PENDING ((ComM_StateType)0x01)
#define COMM_FULL_COM_NETWORK_REQUESTED ((ComM_StateType)0x02)
#define COMM_FULL_COM_READY_SLEEP ((ComM_StateType)0x03)
#define COMM_SILENT_COM ((ComM_StateType)0x04)

/* Handle to identify a user. For each user, a unique value must be defined at system generation time. Maximum number of users is 255. 
Legal user IDs are in the range 0 .. 254;  user ID 255 is reserved and shall have the symbolic representation COMM_NOT_USED_USER_ID. */
typedef uint8 ComM_UserHandleType;

/* Defines whether a mode inhibition is active or not. Inhibition status of ComM.
e.g. status=00000011 -> Wake up inhibition and limitation to COMM_NO_COMMUNICATION mode active 
bit WakeupInhibitionActive: mask 0x01, Bit 0 (LSB): Wake Up inhibition active 
bit LimitedToNoCom: mask 0x02, Bit 1: Limit to COMM_NO_COMMUNICATION mode */
typedef uint8 ComM_InhibitionStatusType;


#endif

